import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JButton;

/**
 * listener na hover pre vsetky buttony
 * @author cerko
 *
 */
public class ButtonMouseListener extends MouseAdapter{
	
	ImageIcon active;
	ImageIcon inactive;
	JButton sender;
	/**
	 * 
	 * @param active - obrazok ked je hover
	 * @param inactive - obrazok ked nie je hover
	 * @param sender - button na ktorom je tento listener
	 */
	public ButtonMouseListener(ImageIcon active, ImageIcon inactive, JButton sender) {
		super();
		this.inactive = inactive;
		this.active = active;
		this.sender = sender;
	}

	/**
	 * zmeni iconu na active
	 */
	public void mouseEntered(MouseEvent e){
		sender.setIcon(active);
	}
	
	/**
	 * zmeni ikonu na inactive
	 */
	public void mouseExited(MouseEvent e){
		sender.setIcon(inactive);
	}
}
